<?php
include_once('common/header.php');
$strRefer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
if($AppUI->id <= 0 || $strRefer == '') {
	$arrJson 	= array('error'=>1,'msg'=>$arrError[1]);
	echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';
	exit();
}
$strContent = $objRequest->getParam('content',null);
$intError	= 0;
if(trim($strContent) == '' || !isset($strContent)) $intError = 1;
elseif(strlen(strip_tags($strContent)) < 2 && $strContent != '') $intError = 2;
if($intError == 0) {
	$objShoutbox = new Shoutbox();
	$objShoutbox->insert($AppUI->id, Vfriend_Function::stripTags($strContent,0));
	$strMessage	 = $arrMessage[10];
	include_once('index/box-shoutbox.php');
	$this->view->ajax 	= 1;
	$objView			= Zend_Registry::get('objView');
	$strShoutbox		= $objView->fetch('index/box-shoutbox.tpl');
	$arrJson	= array('error'		=> $intError, 							
						'msg'		=> $strMessage,
						'dshoutbox'	=> $strShoutbox
					);
}
if($intError > 0) {	
	$strError	= $arrError[$intError];
	$arrJson 	= array('error'=>$intError,'msg'=>$strError);
}
echo $objRequest->getParam('callback') . '(' . Zend_Json::encode($arrJson) . ')';
exit();
?>
